<template>
  <div class="album-list">
    <div>
      <ul class="ml-5 my-3">
        <li v-for="item in albumList" :key="item.id" class="d-flex ai-center pb-2">
          <!-- <div class="album-name px-2 text-x" @click="toAlbumDetail(item.mid)"></div> -->
          <img v-lazy="item.picUrl" width="100" class="pt-3" @click="toAlbumDetail(item.id)" @load="imgLoadEnd">
          <div class="d-flex flex-wrap pl-4">
            <div class="w100 text-m pb-2">{{item.name}}</div>
            <div class="text-darkgray">{{item.artist.name}}</div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
  export default {
    props: {
      albumList: Array
    },
    methods: {
      toAlbumDetail(id) {
        this.$emit('to-album-detail', id)
      },
      imgLoadEnd() {
        this.$emit('img-load-end')
      }
    }
  }
</script>

<style scoped>
  .album-name {
    width: 100px;
    height: 100px;
    border: 1px solid black;
    text-align: center;
    padding-top: 30px;
    color: white;
    background-color: #000000;
  }

  .album-list {
    padding-bottom: 2.5rem;
  }
</style>
